﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KL.Store.Core.Domain;
using TN.Data;

namespace KL.Store.Data
{
    public class dbWishListDetail
    {

        #region Insert

        public static int Insert(int UserId, long ListId, int ProductId, System.Decimal Qty)
        {
            int Result = (int)SqlHelper.ExecuteScalar(dbParameters.dsnStore, "SPR_ESTORE_WishList_AddProduct", new object[] { UserId, ListId, ProductId, Qty });
            return Result;
        }

        #endregion

        #region Update

        public static void Update(int UserId, long ListId, int ProductId, decimal Qty, int UpdateUser)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_WishListDetail_Update", new object[] { UserId,  ListId,  ProductId,  Qty,  UpdateUser });
        }

        #endregion

        #region Delete

        public static int Delete(int UserId, long ListId, int ProductId)
        {
            int Result = (int)SqlHelper.ExecuteScalar(dbParameters.dsnStore, "SPR_ESTORE_WishList_DeleteProduct", new object[] { UserId, ListId, ProductId });
            return Result;
        }

        #endregion

        #region GetList

        public static IList<WishListDetail> GetList(int UserId, long ListId)
        {
            IList<WishListDetail> objectList = new List<WishListDetail>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_WishListDetail_List", objectList, new object[] { UserId, ListId });

            return objectList;
        }

        #endregion
    }
}
